<?php

/*
Plugin Name: Kodax Widgets Plugin
Plugin URI: http://www.themecanon.com
Description: Custom widgets for Kodax theme by Theme Canon.
Version: 1.0
Author: Theme Canon
Auhtor URI: http://www.themecanon.com
*/


/**************************************
NOTES

Plugins in this widget:
- Kodax: More Posts.
- Kodax: Twitter.
- Kodax: Search.

- Kodax: More Posts.
This widget taps into the post meta: "post_views" to determine most popular posts by view. (NB: data not supplied by plugin).
This widget uses a custom field (post): "cmb_hide_from_popular". (NB: data not supplied by plugin).

***************************************/

/**************************************
INDEX

PLUGIN LOCALIZATION INIT
PHP INCLUDES
WP ENQUEUE
IMAGE SIZES

***************************************/

/**************************************
PLUGIN LOCALIZATION INIT
***************************************/

	add_action('after_setup_theme', 'kodax_widgets_plugin_localization_setup');
	function kodax_widgets_plugin_localization_setup() {
	    load_plugin_textdomain('loc_kodax_widgets_plugin', false,  dirname( plugin_basename( __FILE__ ) ) . '/lang/');
	}


/**************************************
PHP INCLUDES
***************************************/

	// include widgets
	include 'inc/widgets/widget_kodax_more_posts.php';
	include 'inc/widgets/widget_kodax_twitter.php';
	include 'inc/widgets/widget_kodax_search.php';
	include 'inc/widgets/widget_kodax_contact_list.php';



/**************************************
WP ENQUEUE
***************************************/

	//front end includes
	add_action('wp_enqueue_scripts','kodax_widgets_plugin_load_to_front');
	function kodax_widgets_plugin_load_to_front() {

		//front end scripts (js)
		wp_enqueue_script('kodax_widgets_plugin_scripts', plugins_url('', __FILE__ ) . '/js/scripts.js', array(), false, true);



	}

	//back end includes
	add_action('admin_enqueue_scripts', 'kodax_widgets_plugin_load_to_back');  //this was changed to admin_enqueue_scripts from action hook admin_footer. Let's see if it makes a difference
	function kodax_widgets_plugin_load_to_back() {

		//back end scripts (js)
		wp_enqueue_script('jquery');
		// wp_enqueue_script('jquery-ui', false, array(), false, true);
		// wp_enqueue_script('jquery-ui-sortable', false, array(), false, true);
		// wp_enqueue_script('thickbox', false, array(), false, true);					
		// wp_enqueue_script('media-upload', false, array(), false, true);
		// wp_enqueue_script('canon_colorpicker', get_template_directory_uri() . '/js/colorpicker.js', array(), false, true);
		wp_enqueue_script('kodax_widgets_plugin_backend_scripts', plugins_url('', __FILE__ ) . '/js/backend_scripts.js', array(), false, true);
		// wp_enqueue_script('canon_options_slider_scripts', get_template_directory_uri() . '/js/options_slider.js', array(), false, true);


		//style (css)	
		wp_enqueue_style('kodax_widgets_plugin_style', plugins_url('', __FILE__ ) . '/css/style.css');

	}

/**************************************
IMAGE SIZES
***************************************/

	// add_image_size( 'widget_more_posts_thumb', 660, 440, true);
	add_image_size( 'widget_more_posts_thumb', 691, 461, true);

